id: task-120 title: Add offline mode configuration for remote operations status: Done assignee: [] created_date: '2025-07-07' updated_date: '2025-07-07' labels:
- enhancement
- offline
- config dependencies: [] priority: high
Description
Backlog.md currently performs git fetch operations silently in the background when loading remote tasks and generating task IDs. When network connectivity is unavailable, these operations fail silently with errors only visible in debug mode. Users working offline need better visibility into connectivity issues and explicit control over when remote operations are attempted.
Acceptance Criteria
- [x] Add a
remoteOperationsconfig option (default: true) to enable/disable remote git operations - [x] Display informative warnings when remote fetch fails due to network connectivity (not just in debug mode)
- [x] Implement graceful fallback messaging when remote tasks cannot be loaded
- [x] Ensure
backlog board,backlog board view, andbacklog board exportcommands work seamlessly when remote operations are disabled - [x] Task ID generation continues to work when remote operations are disabled (using only local branches)
- [x] Config can be set via
backlog config set remoteOperations false
Technical Notes
Current Behavior:
loadRemoteTasks()insrc/core/remote-tasks.tscallsgitOps.fetch()but only shows errors in debug modegenerateNextId()insrc/cli.tsperforms git fetch for ID uniqueness but suppresses network errors- Board commands load remote tasks in parallel but fail silently when offline
Proposed Implementation:
- Add
remoteOperationsto config schema with validation - Add
remoteOperationsconfig value to migration logic for existing projects - Modify
GitOperations.fetch()to check config before attempting remote operations - Enhance error handling to distinguish network vs. other git errors and provide user-friendly messaging
- Update
loadRemoteTasks()andgenerateNextId()to respect the config setting
Implementation Plan
- Add config schema field - Update
BacklogConfiginterface to includeremoteOperations?: boolean - Update migration logic - Add default value
trueinconfig-migration.tsand check for field inneedsMigration() - Enhance GitOperations - Modify
fetch()to check config and add network error detection - Update core functions - Modify
loadRemoteTasks()andgenerateNextId()to respect config - Update CLI commands - Add support in
config get/set/listcommands - Add comprehensive tests - Unit tests for offline behavior and integration tests for full workflow
- Update documentation - Ensure config commands show the new option
Implementation Notes
- Configuration approach chosen over CLI flags - Using a config value (
remoteOperations) provides a better user experience than requiring--offlineflags on every command - Default value is
true- To maintain backward compatibility, remote operations are enabled by default - Network error detection - Added intelligent error pattern matching to distinguish network errors from other git errors (e.g., "could not resolve host", "connection refused", "network is unreachable")
- Graceful degradation - When offline or when remote operations are disabled, the system continues to work with local data only
- Migration handling - The migration logic filters out
undefinedvalues to ensure defaults are properly applied - Test coverage - Created two comprehensive test suites:
offline-mode.test.tsfor unit tests andoffline-integration.test.tsfor full workflow testing - Config is loaded lazily - Since the Core constructor can't be async, config is loaded when needed via
ensureConfigLoaded() - Parameter naming - Changed
configparameter inloadRemoteTaskstouserConfigto avoid variable shadowing